/**
 * 基础代码 Api
 * @type {SysBaseCodeApi}
 */
const sysBaseCodeApi = new class SysBaseCodeApi extends BaseApi {
    constructor() {
        super('/api/sysBaseCode')
    }

    async selectList() {
        return (await rxajax.get(super.using(`/select-list`))).data.data
    }

    async selectListByType(type) {
        return (await rxajax.get(super.using(`/select-list-type/${type}`))).data.data
    }

    async deleteById(id) {
        return (await rxajax.get(super.using(`/delete/${id}`))).data
    }

    async updateStatusById(id) {
        return (await rxajax.get(super.using(`/update_status/${id}`))).data.data
    }

    async updateOrAdd(data) {
        return (await rxajax.post(super.using(`/update-or-add`), data, {type: 'json'})).data
    }

    async existsById(id) {
        return (await rxajax.get(sysBaseCodeApi.using(`/exists-by-id/${id}`))).data.data
    }

    async existsByTypeAndCode(type, code) {
        return (await rxajax.get(sysBaseCodeApi.using(`/exists-by-type/${type}/and-code/${code}`))).data.data
    }
}